package connector;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.SQLException;
import java.util.Properties;

/**
 * @License: (C) Copyright 2013-2022
 * @Contact: abcque@outlook.com
 * @IDE: IntelliJ IDEA
 * @Encoding: utf-8
 * @Project: st2214st2215
 * @Package: connector
 * @File: Connection1.java
 * @Time: 2023/6/6 15:03
 * @Author: abcque
 * @Description:
 * @Modifier:
 * @ModifyDate:
 * @ModifyRemark:
 */
public class Connection1 {
    public static void main(String[] args) {

        try {
            Driver driver = null;
            driver = new com.mysql.jdbc.Driver();

            String url = "jdbc:mysql://localhost:3306/mysql?useSSL=false";

            Properties properties = new Properties();
            // mysql 用户名
            properties.setProperty("user","root");
            // mysql 用户名对应的密码
            properties.setProperty("password", "it");

            Connection connection = driver.connect(url, properties);
            System.out.println(connection);

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

    }
}
